<?php include ($_SERVER['DOCUMENT_ROOT'].'/insp-modules/misc/config.php');?>
<?php
	$cat_id = $_REQUEST['cid'];
	// $cat_name = $_REQUEST['cname'];
	
	$conn = mysql_connect($host, $user, $password) or die(mysql_error());
	mysql_select_db("etronix");

	$sql_prod = "SELECT * FROM product WHERE CatID='$cat_id'";
	$result_prod = mysql_query($sql_prod, $conn) or die(mysql_error());
	
	while ($row_prod = mysql_fetch_assoc($result_prod)) {
		$prod_id = $row_prod['ProdID'];
		$sql_desc = "SELECT * FROM product WHERE ProdID='$prod_id'";
		$result_desc = mysql_query($sql_desc, $conn) or die(mysql_error());
		while ($row_desc = mysql_fetch_assoc($result_desc)) {
			$prod_desc = $row_desc['ShortDesc'];
			$prod_img_path = $row_desc['Image_path'];
		}
		echo "<div>";
		echo 	"<div class='detail'>";
		echo 		"<div class='detail_img'><img src='/etronix/images/$prod_img_path' /></div>";
		echo 		"<div class='detail_desc'><a name='$prod_id'><b><u>$prod_desc</u></b></a></div>";
		echo 	"</div>";
		
		echo "<div class='general'>";
		$sql_detail_general = "SELECT * FROM proddetails WHERE ProdID='$prod_id' AND Section='General'";
		$result_detail_general = mysql_query($sql_detail_general, $conn) or die(mysql_error());
		while ($row_detail_general = mysql_fetch_assoc($result_detail_general)) {
			$prod_general = $row_detail_general['Value'];
			echo "<p>" . $prod_general . "</p>";
		}
		echo "</div>";
		
		echo "<div class='include'>";
		echo "<p><b>What's Included</b></p>";
		echo "<ul>";
		$sql_detail_include = "SELECT * FROM proddetails WHERE ProdID='$prod_id' AND Section='What is Included'";
		$result_detail_include = mysql_query($sql_detail_include, $conn) or die(mysql_error());
		while ($row_detail_include = mysql_fetch_assoc($result_detail_include)) {
			$prod_include = $row_detail_include['Value'];
			echo "<li>$prod_include</li>";
		}
		echo "</ul>";
		echo "</div>";
		
		echo "<div class='feature'>";
		echo "<p><b>Product Features</b></p>";
		echo "<ul>";
		$sql_detail_feature = "SELECT * FROM proddetails WHERE ProdID='$prod_id' AND Section='Product Features'";
		$result_detail_feature = mysql_query($sql_detail_feature, $conn) or die(mysql_error());
		while ($row_detail_feature = mysql_fetch_assoc($result_detail_feature)) {
			$prod_attr = $row_detail_feature['Attrib'];
			$prod_feature = $row_detail_feature['Value'];
			echo "<li><b>$prod_attr</b><br/>$prod_feature</li>";
		}
		echo "</ul>";
		echo "</div>";
		echo "<hr />";
		echo "<div class='anchor'>";
		echo "<a href='#top'>Top</a><a style='float: right' href='#bottom'>Bottom</a>";
		echo "</div>";
		echo "<hr />";
		echo "</div>";
	}
?>